class seg():
    def __init__(self, lo=0, hi=0):
        if hi < lo:
            raise Exception('bad segment')
        self.lo = lo
        self.hi = hi
    def __str__(self):
        return '['+str(self.lo)+','+str(self.hi)+']'
    def __lt__(self, other):
        return self.lo < other.lo
    def __le__(self, other):
        return self.lo <= ohter.lo
    def __eq__(self, other):
        if other == 'NIL': return False
        return self.lo == other.lo
    def __ne__(self, ohter):
        return self.lo != other.lo
    def __gt__(self, other):
        return self.lo > other.lo
    def __ge__(self, ohter):
        return self.lo >= other.lo
    def inleft(self, other):
        return self.hi < other.lo
    def inright(self, other):
        return self.lo > other.hi
    def cross(self, other):
        return self.lo <= other.hi and other.lo <= self.hi
    def compare(self, other):
        if self.inleft(other):
            return 'in left'
        elif slef.inright(other):
            return 'in right'
        else:
            return 'corss'